package com.evaluation.security;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class EvalWebMvcConfigurer implements WebMvcConfigurer {
	
	private AdminInterceptor adminInterceptor;

	
	public EvalWebMvcConfigurer( AdminInterceptor adminInterceptor ) {
		this.adminInterceptor = adminInterceptor;
	}
	
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		//registry.addInterceptor(null).
		/**
		registry.addWebRequestInterceptor( omvi )
			.excludePathPatterns("/**.css","/**.js", "/AdmintLTE/**", "/**.jpg", "/**.png", "/**.gif", "/**.jpeg", "/**.html");
			**/
		registry.addInterceptor(adminInterceptor).addPathPatterns("/**")
			.excludePathPatterns("/**/*.css","/**/*.js", "/AdmintLTE/**", "/**/*.jpg", "/**/*.png", "/**/*.gif", "/**/*.jpeg", 
					"/font-awesome/**", "/**/*.html", "/jenkins/**", "/**/*.map", "/js/**", "/*.ico", "/**/*.woff2");
		
	}
	
	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		
		registry.addResourceHandler("/static/**").addResourceLocations("classpath:/public/").resourceChain(true);
	}
}
